warn in 2015, error in 2018
authorDale Wijnand <dale.wijnand@gmail.com>
Tue, 10 Apr 2018 14:10:38 +0000 (15:10 +0100)
committerDale Wijnand <dale.wijnand@gmail.com>
Tue, 10 Apr 2018 14:10:38 +0000 (15:10 +0100)
src/cargo/ops/cargo_install.rs
tests/testsuite/install.rs

index 9984c3952e162c512a0fcdbde4116f0772d1a718..7987eb1e70d3db5ea628acbe79b0b90480da4da9 100644 (file)
@@ -235,10 +235,18 @@ fn install_one(
 
     if from_cwd {
         match pkg.manifest().edition() {
-            Edition::Edition2015 => (),
-            Edition::Edition2018 => {
-                config.shell().warn("To build the current package use 'cargo build', to install the current package run `cargo install --path .`")?;
-            },
+            Edition::Edition2015 =>
+                config.shell().warn("To build the current package use `cargo build`, to install the current package run `cargo install --path .`")?
+            ,
+            Edition::Edition2018 =>
+                bail!(
+                    "To build the current package use `cargo build`, \
+                     to install the current package run `cargo install --path .`, \
+                     otherwise specify a crate to install from \
+                     crates.io, or use --path or --git to \
+                     specify alternate source"
+                )
+            ,
         }
     };
 
index 3224f269f3253ec8baec49a01850d2bdbb65f531..8e3baa8cf806ac3f9a4367315f11cc565ede3b6c 100644 (file)
@@ -1009,7 +1009,11 @@ fn installs_from_cwd_by_default() {
 
     assert_that(
         cargo_process("install").cwd(p.root()),
-        execs().with_status(0),
+        execs().with_status(0).with_stderr_contains(
+                "\
+warning: To build the current package use `cargo build`, to install the current package run `cargo install --path .`
+",
+        ),
     );
     assert_that(cargo_home(), has_installed_exe("foo"));
 }
@@ -1039,13 +1043,13 @@ fn installs_from_cwd_with_2018_warnings() {
 
     assert_that(
         cargo_process("install").cwd(p.root()).masquerade_as_nightly_cargo(),
-        execs().with_status(0).with_stderr_contains(
-            "\
-warning: To build the current package use 'cargo build', to install the current package run `cargo install --path .`
-",
-        ),
+        execs().with_status(101).with_stderr_contains(
+            "error: To build the current package use `cargo build`, \
+             to install the current package run `cargo install --path .`, \
+             otherwise specify a crate to install from crates.io, \
+             or use --path or --git to specify alternate source\
+        "),
     );
-    assert_that(cargo_home(), has_installed_exe("foo"));
 }
 
 #[test]